# Copyright (c) 2022 Presto Labs Pte. Ltd.
# Author: gekim

from presto_labs_client import PrestoLabsClient, Channel
import pandas as pd

def main():
  presto_labs_client = PrestoLabsClient()
  messages = presto_labs_client.replay(
    mea="Spot.Binance.v1",
    from_date="2022-08-01",
    to_date="2022-10-01",
    filters=[
      Channel(name="volume", #other_stats, time, volume, vwap, ohlc
              duration="PT1M", 
              symbols=["BTC-USDT", "ETH-USDT"]),
      Channel(name="vwap", #other_stats, time, volume, vwap, ohlc
              duration="PT1M", 
              symbols=["BTC-USDT", "ETH-USDT"]),
      Channel(name="ohlc", #other_stats, time, volume, vwap, ohlc
              duration="PT1M", 
              symbols=["BTC-USDT", "ETH-USDT"])
      ]
  )

  with open("btc_eth_volume_vwap_ohlc.csv", 'w') as f:
    for message in messages:
      f.write(",".join(map(str, message)) + '\n')

if __name__ == '__main__':
  main()
